<template>
	<view>
		<view class="username">
			<view>姓名</view>
			<view>{{userinfo.nickname}}</view>
		</view>
		<view class="username">
			<view>手机号</view>
			<view>{{userinfo.mobile}}</view>
		</view>
		<view class="username" @click="goPath('/pages/user/code/code')">
			<view>修改密码</view>
			<image src="/static/images/left.png" mode=""></image>
		</view>
		<button class="btn" @click="loginOut()">退出</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userinfo: uni.getStorageSync('userinfo')
			}
		},
		methods: {
			loginOut() {
				uni.showModal({
					content: '您确定要退出吗？',
					success: (res) => {
						if (res.cancel) return
						this.$store.commit('logout')
						this.$toast({ title: "退出成功", time: 2000, }, () => {
							uni.reLaunch({
								url: '/pages/login/login'
							})
						})
					}
				})

			}
		}
	}
</script>

<style lang="scss">
	.username {
		display: flex;
		width: 670rpx;
		justify-content: space-between;
		margin: 0 auto;
		height: 100rpx;
		align-items: center;
		border-bottom: solid 2rpx #DDE0E4;

		view:nth-child(1) {
			color: #000000;
			font-size: 28rpx;
		}

		view:nth-child(2) {
			color: #666666;
			font-size: 28rpx;
		}

		image {
			width: 14rpx;
			height: 28rpx;
		}
	}

	.btn {
		width: 240rpx;
		height: 80rpx;
		background: #00809F;
		border-radius: 16rpx;
		color: #FFF;
		margin-top: 300rpx;
		font-size: 32rpx;
		line-height: 80rpx;
	}
</style>